package Game;

import java.awt.Graphics;
import java.awt.Rectangle;

import Levels.LevelLoader;

public class Portal {
	 public double x;
	 public double y;
	 protected Sprite sprite;
	 protected double dx;
	 protected double dy;
	 protected int ID;
	 boolean left,right,up,down,collision,pCollision;
	 	/**
		 * 0=non existent
		 * 1=soft
		 * 2=not soft
		 * 3=not hard
		 * 4=hard
		 */
	 protected int hardness=1;
	 private Rectangle me;
	 	/**
	 	 * 
	 	 * @param ref
	 	 * @param x
	 	 * @param y
	 	 */
	 	public Portal(Sprite sprite,int ID,int x,int y){
	 		this.sprite = sprite;
	 		this.ID=ID;
	 		this.x = x;
	 		this.y = y;
	 		me = new Rectangle(getX(),getY(),sprite.getWidth(),sprite.getHeight());
	 	}
	 	public void setSprite(Sprite newSprite,int NewID){
	 		this.sprite=newSprite;
	 		this.ID=NewID;
	 	}
	 	public int getID(){
	 		return ID;
	 	}
	 	public Rectangle getMe(){
	 		return me;
	 	}
	 	protected long delta=1500;
	 	public void setDelta(long delta){
	 		this.delta=delta;
	 	}
	 	public void move(){
			this.x += ((delta*dx)/1000);
			this.y += ((delta*dy)/1000);
	 	}
	 	/**Set the horizontal movement*/
	 	public void setHorMove(double dx){
	 		this.dx = dx;
	 	}
	 	/**Set the Vertical movement*/
	 	public void setVerMove(double dy){
	 		this.dy = dy;
	 	}
	 	/**Get the horizontal movement*/
	 	public double getHorMove(){
	 		return dx;
	 	}
	 	/**Get the Vertical movement*/
	 	public double getVerMove(){
	 		return dy;
	 	}
	 	public int getXBound(){
	 		return sprite.getWidth();
	 	}
	 	public int getYBound(){
	 		return sprite.getHeight();
	 	}
	 	public Sprite getSprite(){
	 		return sprite;
	 	}
	 	public void Draw(Graphics g,int index,int nx,int ny){
	 		sprite.Draw(g,(int) x-nx,(int) y-ny,index);
	 	}
	 	/**
	 	 * 0=nothing
	 	 * 1=slow walk
	 	 * 2=soft
	 	 * 3=hard weak
	 	 * 4=hard
	 	 * @param Hardness
	 	 */
	 	public void setHardness(int hardness){
	 		this.hardness=hardness;
	 	}
	 	public int getX(){
	 		return (int) x;
	 	}
	 	public int getY(){
	 		return (int) y;
	 	}
	 	private String destanation="level_2";
	 	public void setDestanation(String dest){
	 		destanation=dest;
	 	}
	 	public void hit(Dude character){
	 		Mainth.level.setLevel(destanation);
	 	}
}
